package com.appbee.core.client.place;

import javax.inject.Inject;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.place.shared.PlaceHistoryMapper;

public class PlaceControl extends PlaceController
{
	private PlaceHistoryHandler.Historian historian;
	private PlaceHistoryMapper mapper;
	
	@Inject
	public PlaceControl(EventBus eventBus,PlaceHistoryHandler.Historian historian,PlaceHistoryMapper mapper)
	{
		super(eventBus);
		this.historian = historian;
		this.mapper = mapper;
	}
	
	public void setPlaceStateChange(Place place)
	{
		String token = mapper.getToken(place);
		if(token!=null)
		{
			historian.newItem(token, false);
		}
	}

}
